/**
 *
 */
function MainMenuAssistant() {
  
  this.canvasBenchmarkBind = this.canvasBenchmark.bind(this);

};


/**
 *
 */
MainMenuAssistant.prototype.canvasBenchmarkBind = null;


/**
 *
 */
MainMenuAssistant.prototype.setup = function() {

  this.controller.setupWidget("mainMenu_btnCanvasDrawImage1", { },
    { label : "Canvas Draw Image x1" }
  ); 
  Mojo.Event.listen(this.controller.get("mainMenu_btnCanvasDrawImage1"), 
    Mojo.Event.tap, this.canvasBenchmarkBind
  ); 

  this.controller.setupWidget("mainMenu_btnCanvasDrawImage10", { },
    { label : "Canvas Draw Image x10" }
  ); 
  Mojo.Event.listen(this.controller.get("mainMenu_btnCanvasDrawImage10"), 
    Mojo.Event.tap, this.canvasBenchmarkBind
  ); 

  this.controller.setupWidget("mainMenu_btnCanvasDrawImage50", { },
    { label : "Canvas Draw Image x50" }
  ); 
  Mojo.Event.listen(this.controller.get("mainMenu_btnCanvasDrawImage50"), 
    Mojo.Event.tap, this.canvasBenchmarkBind
  );

  this.controller.setupWidget("mainMenu_btnCanvasDrawImage100", { },
    { label : "Canvas Draw Image x100" }
  ); 
  Mojo.Event.listen(this.controller.get("mainMenu_btnCanvasDrawImage100"), 
    Mojo.Event.tap, this.canvasBenchmarkBind
  );

  this.controller.setupWidget("mainMenu_btnCanvasDrawImage250", { },
    { label : "Canvas Draw Image x250" }
  ); 
  Mojo.Event.listen(this.controller.get("mainMenu_btnCanvasDrawImage250"), 
    Mojo.Event.tap, this.canvasBenchmarkBind
  );
  
  
  this.controller.setupWidget("mainMenu_btnCanvasDrawImage500", { },
    { label : "Canvas Draw Image x500" }
  ); 
  Mojo.Event.listen(this.controller.get("mainMenu_btnCanvasDrawImage500"), 
    Mojo.Event.tap, this.canvasBenchmarkBind
  );
  
  
  this.controller.setupWidget("mainMenu_btnCanvasDrawImage1000", { },
    { label : "Canvas Draw Image x1000" }
  ); 
  Mojo.Event.listen(this.controller.get("mainMenu_btnCanvasDrawImage1000"), 
    Mojo.Event.tap, this.canvasBenchmarkBind
  );

};


/**
 *
 */
MainMenuAssistant.prototype.canvasBenchmark = function(inEvent) {
  
    this.controller.showAlertDialog({
    onChoose : function(inValue) {
      switch (inEvent.target.outerText) {
        case "Canvas Draw Image X1":
          Mojo.Controller.stageController.pushScene("canvasDrawImage", 1);
        break;
        case "Canvas Draw Image X10":
          Mojo.Controller.stageController.pushScene("canvasDrawImage", 10);
        break;
        case "Canvas Draw Image X50":
          Mojo.Controller.stageController.pushScene("canvasDrawImage", 50);
        break;
        case "Canvas Draw Image X100":
          Mojo.Controller.stageController.pushScene("canvasDrawImage", 100);
        break;
        case "Canvas Draw Image X250":
          Mojo.Controller.stageController.pushScene("canvasDrawImage", 250);
        break;
        case "Canvas Draw Image X500":
          Mojo.Controller.stageController.pushScene("canvasDrawImage", 500);
        break;
        case "Canvas Draw Image X1000":
          Mojo.Controller.stageController.pushScene("canvasDrawImage", 1000);
        break;
      }
    },
    title : "Instructions",
    message : 
      "You can use the W (up), Z (down), A (left) and d (right) keys to " +
      "move Gentoo (the green guy) around while Krelmac (the blue guy) " +
      "bounces around randomly.  This shows how keypress events impact " +
      "performance and GC hits.  Tap the screen to see the tap event's " +
      "impact (the event is NOT captured, but it still has an effect).  " +
      "The number at the bottom is how long the previous frame took " +
      "to process." +
      "Press the spacebar to see a sumary report and exit the test.  ",        
    choices : [
      { label : "Ok" }    
    ]
  });
  
};